﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using PickExperts2.Class;

namespace PickExperts2.form
{
    public partial class fmMain : Form
    {
        private ArrayList fmList = new ArrayList();

        public fmMain()
        {
            InitializeComponent();
        }

        private void fmMain_Load(object sender, EventArgs e)
        {
            Init();
            //Class.main cm = new main();
            //cm.showWaitForm();
        }

        private void Init()
        {
            Class.IniFile cIniFile = new IniFile(Class.main.iniFPath);
            Class.main cMain = new main();
            fmStartPage fs = new fmStartPage(tabControl1);
            if (cIniFile.ReadInivalue("PickExperts2", "StartPage").ToLower() == "true")
            {
                fmList.Add(cMain.showFormInTab(tabControl1, fs, "起始页"));
            }
        }

        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void 显示历史记录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmHistory fh = new fmHistory();
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "历史记录"));
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            fmBrowse fh = new fmBrowse(Class.main.homePage,tabControl1);
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "浏览器"));
        }

        private void tabControl1_DoubleClick(object sender, EventArgs e)
        {
            if(tabControl1.TabCount>0)
            {
                int index = tabControl1.SelectedIndex;
                tabControl1.TabPages.RemoveAt(index);
                if (index - 1 >= 0)
                    tabControl1.SelectTab(index - 1);
            }
        }

        private void 号码生成器ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmPicker fp = new fmPicker();
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fp, "号码生成"));
        }

        private void 淘宝图表ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmBrowse fh = new fmBrowse(Class.main.taobao图表, tabControl1);
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "图表"));
        }

        private void 万图表ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmBrowse fh = new fmBrowse(Class.main.wubai图表, tabControl1);
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "图表"));
        }

        private void 福彩图表ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmBrowse fh = new fmBrowse(Class.main.fucai图表, tabControl1);
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "图表"));
        }

        private void 显示历史选号ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmPickHistory fh = new fmPickHistory();
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "选号记录"));
        }

        private void 淘宝网ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmBrowse fh = new fmBrowse(Class.main.taobao代购, tabControl1);
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "代购"));
        }

        private void 万网ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmBrowse fh = new fmBrowse(Class.main.wubai代购, tabControl1);
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fh, "代购"));
        }

        private void 号码生成器缠禅规则ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmPicker_CC fp = new fmPicker_CC();
            Class.main cMain = new main();
            fmList.Add(cMain.showFormInTab(tabControl1, fp, "号码生成-缠禅"));
        }
    }
}
